<%-- 
    Document   : addAnswer
    Created on : Oct 29, 2009, 11:05:15 AM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*" %>
<%@taglib prefix="ajax" uri="http://ajaxtags.org/tags/ajax" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <jsp:include page="../header.jsp" />
        <title>JSP Page</title>
    </head>
    <body>
        <%
            int id = Integer.parseInt(request.getParameter("id"));
            int key = Integer.parseInt(request.getParameter("key"));
        %>
        <form action="include/actionAddAnswer.jsp" method="post">
            <table border="1">
                <thead>
                    <tr>
                        <th></th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>ContentAnswer : </td>
                        <td><input type="text" name="Answer" /></td>
                    </tr>
                    <tr>
                        <td>TrueOrFalse : </td>
                        <td>True : <input type="radio" name="TrueOrFalse" value="True"  />
                            False : <input type="radio" name="TrueOrFalse" value="False" checked="true" /></td>
                    </tr>
                </tbody>
            </table>
            <input type="hidden" value="<%=id%>" name="AnswerID" />
            <input type="hidden" value="<%=key%>" name="key" />
            <input type="submit" value="Add ContentAnswer" />
        </form>
            <jsp:useBean id="ObjectAnswer" class="DAO.DAOAdmin" scope="request" />
            <table border="1" style="border:solid 1px; border-collapse:collapse">
                <thead>
                    <tr>
                        <th>AnswerId</th>
                        <th>QuestionID</th>
                        <th>ContentQuestion</th>
                        <th>TrueOrFalse</th>
                        <th>Editter</th>
                    </tr>
                </thead>
                <tbody>
                    <%
                        ResultSet rs = ObjectAnswer.selectAnswer2(id);
                        while(rs.next())
                            {

                    %>
                    <tr>
                        <td><%=rs.getString(1) %></td>
                        <td><%=rs.getString(2) %></td>
                        <td><%=rs.getString(3) %></td>
                        <td><%=rs.getString(4) %></td>
                        <td>
                            <ajax:anchors target="displayQuestion" >
                                <a href="editAnswer.jsp?content=<%=rs.getString("AnswerContent") %>&id=<%=rs.getString("AnswerID") %>&key=<%=key%>" ><img src="../images/button/system/24-tool-a.png" alt="Edit"  border="0"/></a>
                            </ajax:anchors>
                        </td>
                    </tr>
                    <% } %>
                </tbody>
            </table>

    </body>
</html>
